<!doctype html>
<html lang="zh-CN">
  <head>
    <meta charset="UTF-8" />
    <meta
      name="viewport"
      content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"
    />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>纯CSS轮播图 - Level 4 (淡入淡出)</title>
    <style>
      * {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
        user-select: none;
      }

      body {
        display: flex;
        justify-content: center;
        align-items: center;
        min-height: 100vh;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
      }

      .carousel-container {
        position: relative;
        width: 800px;
        height: 500px;
        overflow: hidden;
        border-radius: 20px;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
      }

      .carousel-item {
        position: absolute;
        width: 100%;
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 48px;
        font-weight: bold;
        color: white;
        text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
        opacity: 0;
        animation: fade 16s infinite;
      }

      .carousel-item:nth-child(1) {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        animation-delay: 0s;
      }

      .carousel-item:nth-child(2) {
        background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
        animation-delay: 4s;
      }

      .carousel-item:nth-child(3) {
        background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
        animation-delay: 8s;
      }

      .carousel-item:nth-child(4) {
        background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
        animation-delay: 12s;
      }

      @keyframes fade {
        0%, 20% {
          opacity: 0;
        }
        25%, 95% {
          opacity: 1;
        }
        100% {
          opacity: 0;
        }
      }

      .title {
        position: absolute;
        top: 20px;
        left: 50%;
        transform: translateX(-50%);
        color: white;
        font-size: 24px;
        font-weight: bold;
        text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
        z-index: 10;
      }
    </style>
  </head>
  <body>
    <div class="carousel-container">
      <div class="title">纯CSS轮播图 - Level 4 (淡入淡出)</div>
      <div class="carousel-item">Slide 1</div>
      <div class="carousel-item">Slide 2</div>
      <div class="carousel-item">Slide 3</div>
      <div class="carousel-item">Slide 4</div>
    </div>
  </body>
</html>

